package designPattern.observer;

public class TestObserver {

    public static void main(String[] args) {
        Subject subject = new FoodSubject();

        Observer countObserver = new CountObserver();
        Observer foodObserver = new FoodObserver();

        subject.registerObserver(countObserver);
        subject.registerObserver(foodObserver);
        subject.operation();

        System.out.println("移除观察者countObserver");
        subject.removerObserver(countObserver);
        subject.operation();
    }

}
